package scala.test_class.test_simple

import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion.User

/**
 * @author 黄海峰 2021/4/15 17:21
 * */
object ClassTest {
  def main(args: Array[String]): Unit = {
    // 最简类定义
    val user = new User
    println(user)
    val patient = Patient
    println(patient)

    println("======================>")

    // 定义类 包括参数，重写默认方法
    val point = new Point(2, 3)
    point.move(1, 2)
    println(point.x)
    println(point)

    println("======================>")

    // class定义默认值后，即可选择性传入参数
    val point2 = new Point(2)
    println(point2)

    val point3 = new Point
    println(point3)
    val point4 = new Point()
    println(point4)
    val point5 = new Point(y = 66)
    println(point5)
    val point6 = new Point(y = 22, x = 33)
    println(point6)

    println("======================>")

    // 具有 getter  setter 的 class
    val pointTwo = new PointTwo
    pointTwo.x = 11
    pointTwo.y = 22
    println(pointTwo)
    pointTwo.x = 200
    println(pointTwo)
    pointTwo.y = 300
    println(pointTwo)
    //    println(pointTwo.printWarning(1))
    println("======================>")
  }
}
